<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>客户贡献分析</title>
    <link rel="stylesheet" href="/box/layui/css/layui.css">
    <script src="/box/js/jquery-3.3.1.js"></script>
    <script src="/box/layui/layui.js"></script>
    <script src="/box/js/config.js"></script>
    <link rel="shortcut icon" href="/box/assets/ico/minus.png">
    <style>
        .box-pad {
            padding: 1%
        }
    </style>
</head>

<body>
    <div class="box-pad">
        <h1>客户贡献分析</h1>
        <hr>
        <form class="layui-form" id="topForm" lay-filter="topForm">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">客户名：</label>
                    <div class="layui-inline">
                        <input type="text" id="customerName" class="layui-input" autocomplete="off">
                    </div>
                </div>
                <button type="button" class="layui-btn" style="margin-bottom: 10px" onclick="selects()">查询</button>
            </div>
        </form>
        <table class="layui-table" lay-filter="contriTable" id = "contriTable"></table>
        <script>
            var table;
            layui.use(['table','form'], function (){
                table = layui.table;
                var form = layui.form;
                //  表格渲染
                table.render({
                    elem: '#contriTable'
                    ,url:'http://localhost:8888/order/offer'
                    ,text: {none: '没有查到相关数据'}
                    ,even: true
                    ,page : true
                    ,limit : 10
                    ,cols: [[
                        {field:'eleCustomer', title: '客户名称', templet : function (d) {
                                return d.eleCustomer.customerName;
                            }
                        }
                        ,{field:'totalSum', title: '金额'}
                    ]]
                });
            });
            function selects(){
                table.reload("contriTable",{
                    page: {
                        curr: 1
                    }
                    ,where: {
                        "name" : $("#customerName").val()
                    }
                });
            }
        </script>
    </div>
</body>
</html>